/**
 * Application Application.java
 */

package CCT220_Aula21_Exercicio03_13106;


import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SpringLayout;


/**
 * <div style="border-style:double;">
 * Project: CCT220
 * </br>Package: CCT220_Aula21_Exercicio03_13106
 * </br>Class: Application
 * </br>Created by marcel
 * </br>Description:
 * </div>
 * 
 * @author marcel
 * @author 13106
 * 
 */
public class Application {
	/**
	 * Create the GUI and show it. For thread safety,
	 * this method should be invoked from the
	 * event-dispatching thread.
	 */
	private static void createAndShowGUI() {

		String[] labels = { "Nome: ", "Endereco: ", "Telefone: ", "E-mail: " };
		int numPairs = labels.length;

		// Create and populate the panel.
		JPanel p = new JPanel(new SpringLayout());
		for (int i = 0; i < numPairs; i++) {
			JLabel l = new JLabel(labels[i], JLabel.TRAILING);
			p.add(l);
			JTextField textField = new JTextField(10);
			l.setLabelFor(textField);
			p.add(textField);
		}
		p.add(new JButton("OK"));
		p.add(new JButton("Cancel"));

		// Lay out the panel.

		SpringUtilities.makeCompactGrid(p, 5, 2, // rows, cols
		        5, 5, // initX, initY
		        5, 5); // xPad, yPad
		SpringUtilities.printSizes(p);
		// Create and set up the window.
		JFrame frame = new JFrame("SpringForm");
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		// Set up the content pane.
		p.setOpaque(true); // content panes must be opaque
		frame.setContentPane(p);

		// Display the window.
		frame.pack();
		frame.setVisible(true);
	}


	public static void main(String[] args) {

		// Schedule a job for the event-dispatching thread:
		// creating and showing this application's GUI.
		javax.swing.SwingUtilities.invokeLater(new Runnable() {
			public void run() {

				createAndShowGUI();
			}
		});
	}

}
